package com.ldw.controller;

import com.ldw.pojo.Comment;
import com.ldw.service.CommentService;
import com.ldw.vo.CommentParam;
import com.ldw.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comments")
public class CommentController {

    @Autowired
    private CommentService commentService;

    @GetMapping("/article/{id}")
    public Result comments(@PathVariable("id") Long articleId) {
        return commentService.comments(articleId);
    }

    @PostMapping("/create/change")
    public Result create(@RequestBody CommentParam commentParam) {
        return commentService.comment(commentParam);
    }
}
